package mega.awesome.assignment3;

import android.os.Bundle;
import android.app.TabActivity;
import android.content.Intent;
import android.view.Menu;
import android.widget.TabHost;
import android.widget.TabHost.TabSpec;

public class MainTabActivity extends TabActivity {
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_tab);
		
		TabHost tabHost = getTabHost();

        TabSpec accelSpec = tabHost.newTabSpec("Accelerometer");
        // setting Title and Icon for the Tab
        accelSpec.setIndicator("Accelerometer");
        Intent accelIntent = new Intent(this, AccelerometerActivity.class);
        accelSpec.setContent(accelIntent);
        
        TabSpec compassSpec = tabHost.newTabSpec("Compass");
        // setting Title and Icon for the Tab
        compassSpec.setIndicator("Compass");
        Intent compassIntent = new Intent(this, CompassActivity.class);
        compassSpec.setContent(compassIntent);
        
        TabSpec gpsSpec = tabHost.newTabSpec("GPS");
        // setting Title and Icon for the Tab
        gpsSpec.setIndicator("GPS");
        Intent gpsIntent = new Intent(this, GpsActivity.class);
        gpsSpec.setContent(gpsIntent);
		
        tabHost.addTab(accelSpec);
        tabHost.addTab(compassSpec);
        tabHost.addTab(gpsSpec);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.activity_tab, menu);
		return true;
	}

}
